<?php

use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;

Admin::routes();

Route::group([
    'prefix'        => config('admin.route.prefix'),
    'namespace'     => config('admin.route.namespace'),
    'middleware'    => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', 'HomeController@index');

    // 配置项
    $router->name('admin')->resource('configs', 'Configs\ConfigController');
    $router->name('admin')->resource('live-configs', 'Configs\LiveConfigController');
    $router->name('admin')->resource('sms-configs', 'Configs\SmsConfigController');
    $router->name('admin')->resource('alipay-configs', 'Configs\AlipayConfigController');
    $router->name('admin')->resource('shop-configs', 'Configs\ShopConfigController');

    $router->name('admin')->resource('users', 'UserController');
    $router->name('admin')->resource('lives', 'LiveController');
    $router->name('admin')->resource('user-addresses', 'UserAddressController');
    $router->name('admin')->resource('products', 'ProductController');
    // 订单发货
    $router->post('orders/{order}/ship', 'OrderController@ship')->name('admin.orders.ship');
    // 处理订单退款
    $router->post('orders/{order}/refund', 'OrderController@handleRefund')->name('admin.orders.handle_refund');
    // 订单资源路由
    $router->name('admin')->resource('orders', 'OrderController');
    // 商品分类资源路由
    $router->name('admin')->resource('categories', 'CategoryController');
    // 商品分类api列表
    $router->name('admin')->get('api/categories', 'CategoryController@apiIndex');
    // 商品标签
    $router->name('admin')->resource('product-tags', 'ProductTagController');
    // 广告管理
    $router->name('admin')->resource('advertisements', 'AdvertisementController');
    // 优惠券管理
    $router->name('admin')->resource('coupon-codes', 'CouponCodeController');
    $router->name('admin')->get('api/able-type', 'CouponCodeController@ableType');
    // 三级联动
    $router->name('admin')->get('api/city', 'AreaController@city');
    $router->name('admin')->get('api/area', 'AreaController@area');
    // 供应商管理
    $router->name('admin')->resource('suppliers', 'SupplierController');
    // 品牌管理
    $router->name('admin')->resource('brands', 'BrandController');
    // 店铺管理
    $router->name('admin')->resource('merchants', 'MerchantController');
    // 物流管理
    $router->name('admin')->resource('logistics', 'LogisticsController');
    // 物流模板
    $router->name('admin')->resource('logistics-templates', 'LogisticsTemplateController');
    $router->post('logistics-templates/{logistics_template}/status', 'LogisticsTemplateController@status')->name('admin.logistics-templates.status');

});
